package com.igeek.boot.mapper;

import com.igeek.boot.entity.Outgoingstock;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author jwj
 * @since 2023-12-26
 */
@Mapper
public interface OutgoingstockMapper extends BaseMapper<Outgoingstock> {

    @Select("SELECT outgoing_name as 'outName',SUM(outgoing_quantity) as 'outCount',   \n" +
            "       SUM(outgoing_quantity) / (SELECT SUM(outgoing_quantity) FROM outgoingstock WHERE station = 1) AS 'ratio' \n" +
            "FROM outgoingstock   \n" +
            "WHERE station = 1  \n" +
            "GROUP BY outgoing_name  \n" +
            "ORDER BY outCount DESC  \n" +
            "LIMIT 0, 4;")
    List<Map<String, Object>> selectHotOutStock(int i);
}
